.class Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;
.super Ljava/lang/Object;
.source "TextViewMultilineEllipse.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0xa
    name = "LineBreaker"
.end annotation


# instance fields
.field private mLengthEllipsis:F

.field private mLengthEllipsisMore:F

.field private mLengthLastLine:F

.field private mLines:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<[I>;"
        }
    .end annotation
.end field

.field private mRequiredEllipsis:Z


# direct methods
.method public constructor <init>()V
    .locals 1

    .prologue
    .line 447
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 448
    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mRequiredEllipsis:Z

    .line 449
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLines:Ljava/util/ArrayList;

    .line 450
    return-void
.end method


# virtual methods
.method public breakText(Ljava/lang/String;ILandroid/text/TextPaint;)I
    .locals 7
    .parameter "input"
    .parameter "maxWidth"
    .parameter "tp"

    .prologue
    const/4 v2, 0x0

    .line 462
    const/4 v4, -0x1

    move-object v0, p0

    move-object v1, p1

    move-object v3, v2

    move v5, p2

    move-object v6, p3

    invoke-virtual/range {v0 .. v6}, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->breakText(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IILandroid/text/TextPaint;)I

    move-result v0

    return v0
.end method

.method public breakText(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IILandroid/text/TextPaint;)I
    .locals 12
    .parameter "input"
    .parameter "ellipsis"
    .parameter "ellipsisMore"
    .parameter "maxLines"
    .parameter "maxWidth"
    .parameter "textPaint"

    .prologue
    .line 482
    iget-object v8, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLines:Ljava/util/ArrayList;

    invoke-virtual {v8}, Ljava/util/ArrayList;->clear()V

    .line 483
    const/4 v8, 0x0

    iput-boolean v8, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mRequiredEllipsis:Z

    .line 484
    const/4 v8, 0x0

    iput v8, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLengthLastLine:F

    .line 485
    const/4 v8, 0x0

    iput v8, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLengthEllipsis:F

    .line 486
    const/4 v8, 0x0

    iput v8, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLengthEllipsisMore:F

    .line 490
    const/4 v8, -0x1

    move/from16 v0, p5

    if-ne v0, v8, :cond_0

    .line 491
    iget-object v8, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLines:Ljava/util/ArrayList;

    const/4 v9, 0x2

    new-array v9, v9, [I

    const/4 v10, 0x0

    const/4 v11, 0x0

    aput v11, v9, v10

    const/4 v10, 0x1

    invoke-virtual {p1}, Ljava/lang/String;->length()I

    move-result v11

    aput v11, v9, v10

    invoke-virtual {v8, v9}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 494
    move-object/from16 v0, p6

    invoke-virtual {v0, p1}, Landroid/text/TextPaint;->measureText(Ljava/lang/String;)F

    move-result v8

    const/high16 v9, 0x3f00

    add-float/2addr v8, v9

    float-to-int v8, v8

    .line 611
    :goto_0
    return v8

    .line 498
    :cond_0
    if-eqz p2, :cond_1

    .line 499
    move-object/from16 v0, p6

    invoke-virtual {v0, p2}, Landroid/text/TextPaint;->measureText(Ljava/lang/String;)F

    move-result v8

    iput v8, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLengthEllipsis:F

    .line 501
    :cond_1
    if-eqz p3, :cond_2

    .line 502
    move-object/from16 v0, p6

    invoke-virtual {v0, p3}, Landroid/text/TextPaint;->measureText(Ljava/lang/String;)F

    move-result v8

    iput v8, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLengthEllipsisMore:F

    .line 506
    :cond_2
    const/4 v6, -0x1

    .line 507
    .local v6, posStartThisLine:I
    const/4 v2, 0x0

    .line 508
    .local v2, lengthThisLine:F
    const/4 v1, 0x1

    .line 509
    .local v1, breakWords:Z
    const/4 v5, 0x0

    .line 510
    .local v5, pos:I
    :goto_1
    invoke-virtual {p1}, Ljava/lang/String;->length()I

    move-result v8

    if-ge v5, v8, :cond_4

    .line 512
    const/4 v8, -0x1

    if-ne v6, v8, :cond_3

    .line 513
    move v6, v5

    .line 516
    :cond_3
    iget-object v8, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLines:Ljava/util/ArrayList;

    invoke-virtual {v8}, Ljava/util/ArrayList;->size()I

    move-result v8

    move/from16 v0, p4

    if-ne v8, v0, :cond_6

    .line 517
    const/4 v8, 0x1

    iput-boolean v8, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mRequiredEllipsis:Z

    .line 599
    :cond_4
    :goto_2
    iget-boolean v8, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mRequiredEllipsis:Z

    if-eqz v8, :cond_5

    .line 600
    iget-object v8, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLines:Ljava/util/ArrayList;

    iget-object v9, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLines:Ljava/util/ArrayList;

    invoke-virtual {v9}, Ljava/util/ArrayList;->size()I

    move-result v9

    add-int/lit8 v9, v9, -0x1

    invoke-virtual {v8, v9}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v4

    check-cast v4, [I

    .line 601
    .local v4, pairLast:[I
    const/4 v8, 0x0

    aget v8, v4, v8

    const/4 v9, 0x1

    aget v9, v4, v9

    add-int/lit8 v9, v9, 0x1

    invoke-virtual {p1, v8, v9}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v8

    move-object/from16 v0, p6

    invoke-virtual {v0, v8}, Landroid/text/TextPaint;->measureText(Ljava/lang/String;)F

    move-result v8

    iput v8, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLengthLastLine:F

    .line 606
    .end local v4           #pairLast:[I
    :cond_5
    iget-object v8, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLines:Ljava/util/ArrayList;

    invoke-virtual {v8}, Ljava/util/ArrayList;->size()I

    move-result v8

    if-nez v8, :cond_f

    .line 607
    const/4 v8, 0x0

    goto :goto_0

    .line 521
    :cond_6
    new-instance v8, Ljava/lang/StringBuilder;

    invoke-direct {v8}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {p1, v5}, Ljava/lang/String;->charAt(I)C

    move-result v9

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;

    move-result-object v8

    const-string v9, ""

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v8

    move-object/from16 v0, p6

    invoke-virtual {v0, v8}, Landroid/text/TextPaint;->measureText(Ljava/lang/String;)F

    move-result v7

    .line 522
    .local v7, widthOfChar:F
    const/4 v3, 0x0

    .line 525
    .local v3, newLineRequired:Z
    invoke-virtual {p1, v5}, Ljava/lang/String;->charAt(I)C

    move-result v8

    const/16 v9, 0xa

    if-ne v8, v9, :cond_8

    .line 526
    const/4 v3, 0x1

    .line 531
    iget-object v8, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLines:Ljava/util/ArrayList;

    const/4 v9, 0x2

    new-array v9, v9, [I

    const/4 v10, 0x0

    aput v6, v9, v10

    const/4 v10, 0x1

    add-int/lit8 v11, v5, -0x1

    aput v11, v9, v10

    invoke-virtual {v8, v9}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 534
    if-gt v5, v6, :cond_7

    .line 535
    const/4 v8, 0x1

    iput-boolean v8, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mRequiredEllipsis:Z

    goto :goto_2

    .line 538
    :cond_7
    add-int/lit8 v8, v5, -0x1

    invoke-virtual {p1, v6, v8}, Ljava/lang/String;->substring(II)Ljava/lang/String;

    move-result-object v8

    move-object/from16 v0, p6

    invoke-virtual {v0, v8}, Landroid/text/TextPaint;->measureText(Ljava/lang/String;)F

    move-result v8

    move/from16 v0, p5

    int-to-float v9, v0

    cmpg-float v8, v8, v9

    if-gez v8, :cond_a

    iget-object v8, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLines:Ljava/util/ArrayList;

    invoke-virtual {v8}, Ljava/util/ArrayList;->size()I

    move-result v8

    move/from16 v0, p4

    if-ne v8, v0, :cond_a

    .line 540
    const/4 v8, 0x0

    iput-boolean v8, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mRequiredEllipsis:Z

    goto/16 :goto_2

    .line 543
    :cond_8
    add-float v8, v2, v7

    move/from16 v0, p5

    int-to-float v9, v0

    cmpl-float v8, v8, v9

    if-ltz v8, :cond_a

    .line 544
    const/4 v3, 0x1

    .line 546
    invoke-virtual {p1, v5}, Ljava/lang/String;->charAt(I)C

    move-result v8

    const/16 v9, 0x20

    if-eq v8, v9, :cond_9

    if-nez v1, :cond_c

    .line 548
    :cond_9
    add-int/lit8 v5, v5, -0x1

    .line 551
    iget-object v8, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLines:Ljava/util/ArrayList;

    const/4 v9, 0x2

    new-array v9, v9, [I

    const/4 v10, 0x0

    aput v6, v9, v10

    const/4 v10, 0x1

    aput v5, v9, v10

    invoke-virtual {v8, v9}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    .line 567
    :cond_a
    :goto_3
    if-eqz v3, :cond_e

    .line 570
    const/4 v6, -0x1

    .line 573
    const/4 v2, 0x0

    .line 576
    iget-object v8, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLines:Ljava/util/ArrayList;

    invoke-virtual {v8}, Ljava/util/ArrayList;->size()I

    move-result v8

    add-int/lit8 v9, p4, -0x1

    if-ne v8, v9, :cond_b

    .line 577
    move/from16 v0, p5

    int-to-float v8, v0

    iget v9, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLengthEllipsis:F

    iget v10, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLengthEllipsisMore:F

    add-float/2addr v9, v10

    sub-float/2addr v8, v9

    float-to-int v0, v8

    move/from16 p5, v0

    .line 581
    const/4 v1, 0x0

    .line 595
    :cond_b
    :goto_4
    add-int/lit8 v5, v5, 0x1

    .line 596
    goto/16 :goto_1

    .line 556
    :cond_c
    :goto_5
    if-ltz v5, :cond_d

    invoke-virtual {p1, v5}, Ljava/lang/String;->charAt(I)C

    move-result v8

    const/16 v9, 0x20

    if-eq v8, v9, :cond_d

    .line 557
    add-int/lit8 v5, v5, -0x1

    goto :goto_5

    .line 561
    :cond_d
    iget-object v8, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLines:Ljava/util/ArrayList;

    const/4 v9, 0x2

    new-array v9, v9, [I

    const/4 v10, 0x0

    aput v6, v9, v10

    const/4 v10, 0x1

    aput v5, v9, v10

    invoke-virtual {v8, v9}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    goto :goto_3

    .line 584
    :cond_e
    add-float/2addr v2, v7

    .line 588
    invoke-virtual {p1}, Ljava/lang/String;->length()I

    move-result v8

    add-int/lit8 v8, v8, -0x1

    if-ne v5, v8, :cond_b

    .line 589
    iget-object v8, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLines:Ljava/util/ArrayList;

    const/4 v9, 0x2

    new-array v9, v9, [I

    const/4 v10, 0x0

    aput v6, v9, v10

    const/4 v10, 0x1

    aput v5, v9, v10

    invoke-virtual {v8, v9}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z

    goto :goto_4

    .line 608
    .end local v3           #newLineRequired:Z
    .end local v7           #widthOfChar:F
    :cond_f
    iget-object v8, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLines:Ljava/util/ArrayList;

    invoke-virtual {v8}, Ljava/util/ArrayList;->size()I

    move-result v8

    const/4 v9, 0x1

    if-ne v8, v9, :cond_10

    .line 609
    move-object/from16 v0, p6

    invoke-virtual {v0, p1}, Landroid/text/TextPaint;->measureText(Ljava/lang/String;)F

    move-result v8

    const/high16 v9, 0x3f00

    add-float/2addr v8, v9

    float-to-int v8, v8

    goto/16 :goto_0

    :cond_10
    move/from16 v8, p5

    .line 611
    goto/16 :goto_0
.end method

.method public getLengthEllipsisMore()F
    .locals 1

    .prologue
    .line 647
    iget v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLengthEllipsisMore:F

    return v0
.end method

.method public getLengthLastEllipsizedLine()F
    .locals 1

    .prologue
    .line 633
    iget v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLengthLastLine:F

    return v0
.end method

.method public getLengthLastEllipsizedLinePlusEllipsis()F
    .locals 2

    .prologue
    .line 640
    iget v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLengthLastLine:F

    iget v1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLengthEllipsis:F

    add-float/2addr v0, v1

    return v0
.end method

.method public getLines()Ljava/util/List;
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()",
            "Ljava/util/List",
            "<[I>;"
        }
    .end annotation

    .prologue
    .line 626
    iget-object v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mLines:Ljava/util/ArrayList;

    return-object v0
.end method

.method public isRequiredEllipsis()Z
    .locals 1

    .prologue
    .line 619
    iget-boolean v0, p0, Lcom/burstly/lib/component/networkcomponent/burstly/TextViewMultilineEllipse$LineBreaker;->mRequiredEllipsis:Z

    return v0
.end method
